
#ifndef SLED_SCENE_MANAGER_CLASS_H 
#define SLED_SCENE_MANAGER_CLASS_H 

#ifdef __cplusplus
extern "C"{
#endif

/*----------------------------------include-----------------------------------*/
#include "sled_scene_manager/sled_scene_manager_class/sled_scene_manager_class_private.h"
#include "sled_scene_manager/sled_scene_manager_class/sled_scene_manager_class_public.h"
#include "sclass.h"
/*-----------------------------------macro------------------------------------*/

/*----------------------------------typedef-----------------------------------*/
typedef struct sled_scene_manager_class
{
/*** public:  ***/
    SLED_SCENE_MANAGER_PUBLIC_MEMBER
/*** private: ***/
    SLED_SCENE_MANAGER_PRIVATE_MEMBER
}sled_scene_manager_class_t;
/*----------------------------------variable----------------------------------*/

/*-------------------------------------os-------------------------------------*/

/*----------------------------------function----------------------------------*/
const char* sled_scene_manager_getCurScene(sled_scene_manager_class_t*this);
int sled_scene_manager_selectScene(sled_scene_manager_class_t*this ,const char *sceneName);

#define SLED_SCENE_MANAGER_CONSTRUCTOR(name,_scene_array,sled_register_cb) \
static sled_scene_manager_class_t name##_sled_scene_manager; \
sled_scene_manager_t *name; \
static const char* name##_sled_scene_manager_getCurScene(void){return sled_scene_manager_getCurScene(&name##_sled_scene_manager);} \
static int name##_sled_scene_manager_selectScene(const char *sceneName){return sled_scene_manager_selectScene(&name##_sled_scene_manager,sceneName);} \
static void name##_spin_lock(void){spin_lock(&(name##_sled_scene_manager.lock));} \
static void name##_spin_unlock(void){spin_unlock(&(name##_sled_scene_manager.lock));} \
static void name##_sled_scene_manager_constructor(void) \
{ \
    sled_scene_manager_class_t* this = &name##_sled_scene_manager; \
    this->spin_lock = name##_spin_lock; \
    this->spin_unlock = name##_spin_unlock; \
    this->getCurrentScene = name##_sled_scene_manager_getCurScene; \
    this->selectScene = name##_sled_scene_manager_selectScene; \
    this->timeout_handle = 0; \
    this->scene_array = _scene_array; \
    sled_register_cb(this->scene_array); \
    led_scene = (sled_scene_manager_t*)(&name##_sled_scene_manager); \
} \
__initcall(name##_sled_scene_manager_constructor);
/*------------------------------------test------------------------------------*/

#ifdef __cplusplus
}
#endif

#endif
